﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace 影片售票系统
{
    public partial class Top : Form
    {
        public Top()
        {
            InitializeComponent();
        }

        private void label9_Click(object sender, EventArgs e)
        {

        }

        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            string name = this.link_name1.Text.Trim();
            Yly.Movie movie = new Yly.Movie(name);
            this.Close();
            movie.Show();
        }

        private void bangdan_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {

        }

        private void shouye_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            MainForm mainform = new MainForm();
            this.Close();
            mainform.Show();
        }

        private void Top_Load(object sender, EventArgs e)
        {
            this.panel5.Visible = true;
            this.panel6.Visible = false;
            #region Top榜单
            //Top榜单
            this.pan_top.BackColor = Color.Orange;
            string name = this.link_name1.Text.Trim();
            string sql = string.Format("select * from T_movie where name='{0}'", name);
            DataTable table = common.DBHelper.read(sql);
            string zx=table.Rows[0]["lujin"].ToString();
            this.lab_actor1.Text=table.Rows[0]["doctor"].ToString();
            this.lab_date1.Text=table.Rows[0]["date"].ToString();
            this.pingf_1.Text=table.Rows[0]["pingfen"].ToString();
            this.pic_1.Image = Image.FromFile(zx);

            string name1 = this.link_name2.Text.Trim();
            string sql1 = string.Format("select * from T_movie where name='{0}'", name1);
            DataTable table1 = common.DBHelper.read(sql1);
            string zx1 = table1.Rows[0]["lujin"].ToString();
            this.lab_actor2.Text = table1.Rows[0]["doctor"].ToString();
            this.lab_date2.Text = table1.Rows[0]["date"].ToString();
            this.pingf_2.Text = table1.Rows[0]["pingfen"].ToString();
            this.pic_2.Image = Image.FromFile(zx1);

            string name2 = this.link_name3.Text.Trim();
            string sql2 = string.Format("select * from T_movie where name='{0}'", name2);
            DataTable table2 = common.DBHelper.read(sql2);
            string zx2 = table2.Rows[0]["lujin"].ToString();
            this.lab_actor3.Text = table2.Rows[0]["doctor"].ToString();
            this.lab_date3.Text = table2.Rows[0]["date"].ToString();
            this.pingf_3.Text = table2.Rows[0]["pingfen"].ToString();
            this.pic_3.Image = Image.FromFile(zx2);
            #endregion
            #region 期待榜单
            string name4 = this.link_name_2_1.Text.Trim();
            string sql5 = string.Format("select * from T_Movie where name='{0}'", name4);
            DataTable table4 = common.DBHelper.read(sql5);
            string zx4=table4.Rows[0]["lujin"].ToString();
            this.pic_2_1.Image = Image.FromFile(zx4);
            this.lab_date_2_1.Text = table4.Rows[0]["date"].ToString();
            this.lab_actor_2_1.Text = table4.Rows[0]["doctor"].ToString();
            this.pingf_2_1.Text = table4.Rows[0]["Love"].ToString();

            string name5 = this.link_name_2_2.Text.Trim();
            string sql6 = string.Format("select * from T_Movie where name='{0}'", name5);
            DataTable table5 = common.DBHelper.read(sql6);
            string zx5 = table5.Rows[0]["lujin"].ToString();
            this.pic_2_2.Image = Image.FromFile(zx5);
            this.lab_date_2_2.Text = table5.Rows[0]["date"].ToString();
            this.lab_actor_2_2.Text = table5.Rows[0]["doctor"].ToString();
            this.pingf_2_2.Text = table5.Rows[0]["Love"].ToString();

            string name6 = this.link_name_2_3.Text.Trim();
            string sql7 = string.Format("select * from T_Movie where name='{0}'", name6);
            DataTable table7 = common.DBHelper.read(sql7);
            string zx6 = table7.Rows[0]["lujin"].ToString();
            this.pic_2_3.Image = Image.FromFile(zx6);
            this.lab_date_2_3.Text = table7.Rows[0]["date"].ToString();
            this.lab_actor_2_3.Text = table7.Rows[0]["doctor"].ToString();
            this.pingf_2_3.Text = table7.Rows[0]["Love"].ToString();

            #endregion
        }

        private void link_name2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            string name = this.link_name2.Text.Trim();
            Yly.Movie movie = new Yly.Movie(name);
            this.Close();
            movie.Show();
        }

        private void link_name3_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            string name = this.link_name3.Text.Trim();
            Yly.Movie movie = new Yly.Movie(name);
            this.Close();
            movie.Show();
        }

        private void linkLabel4_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            this.panel6.Visible = true;
            this.panel5.Visible = false;
            this.pan_top.BackColor = Color.DimGray;
            this.pan_Love.BackColor = Color.Orange;
        }

   

        private void panel6_Paint(object sender, PaintEventArgs e)
        {

        }

        private void linkLabel5_LinkClicked_1(object sender, LinkLabelLinkClickedEventArgs e)
        {
           
        }

        private void linkLabel1_LinkClicked_1(object sender, LinkLabelLinkClickedEventArgs e)
        {

            this.panel5.Visible = true;
            this.panel6.Visible = false;
            this.pan_Love.BackColor = Color.DimGray;
            this.pan_top.BackColor = Color.Orange;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (this.textBox1.Text.Length < 1)
            {
                MessageBox.Show("请输入影片名");
                return;
            }
            string name = this.textBox1.Text.Trim();
            Yly.MovieSelect select = new Yly.MovieSelect(name);
            select.Show();
        }
    }
}
